import './App.scss'
import Login from '@/pages/Login'
import Layout from './pages/Layout'
import NotFound from './pages/NotFound'
import ProfileEdit from './pages/Profile/Edit'
import Chat from './pages/Profile/Chat'
import Search from './pages/Search'
import SearchResult from '@/pages/Search/Result'
import Article from '@/pages/Article'
import history from './utils/history'
import { Router, Route, Switch, Redirect } from 'react-router-dom'
import PrivateRoute from './components/PrivateRoute'
function App() {
  return (
    <Router history={history}>
      <div className="app">
        <Switch>
          <Redirect exact from="/" to="/home"></Redirect>
          <Route path="/login">
            <Login></Login>
          </Route>
          <Route path={'/home'}>
            <Layout></Layout>
          </Route>
          <PrivateRoute path="/edit">
            <ProfileEdit></ProfileEdit>
          </PrivateRoute>
          <PrivateRoute path="/chat">
            <Chat></Chat>
          </PrivateRoute>
          <Route exact path="/search">
            <Search></Search>
          </Route>
          <Route path="/search/result">
            <SearchResult></SearchResult>
          </Route>
          <Route path="/article/:id">
            <Article></Article>
          </Route>
          <Route>
            <NotFound></NotFound>
          </Route>
        </Switch>
      </div>
    </Router>
  )
}

export default App
